
import axios from "@/utils/request"

//登录及用户菜单请求
export async function loginReq(formObj){
    let loginStatus = await axios.post('/login/userInfo',formObj)
    // console.log(loginStatus);    
    return loginStatus
}

//主页修改用户信息后重新查询
export async function reSearchUser(username){
    let changedNewUser = await axios.get(`/index/changedNewUser?username=${username}`)
    return changedNewUser
}

//收藏更改
export const editCollect = async (compObj,collectStatus)=>{
    let changeCollect = await axios.post("/index/editCollect",{compObj,collectStatus})
    return changeCollect
}

//获取用户收藏
export const getUserCollect = async (personid)=>{
    let userCollect = await axios.get(`/index/getUserCollect?personid=${personid}`)
    return userCollect
} 


/**
 * 用户退出 
 * @param {*} personid personid
 * @param {*} sessionid sessionID
 * @param {*} type 退出类型
 * @returns logout
 */
export const userLogout = async (sessionid,personid,type) =>{
    let logout = await axios.post("/index/userLogout",{sessionid,personid,type})
    return logout
}


// 续期token
export const needRenewToken = async (personid) =>{
    let needRenewToken = await axios.post("/index/needRenewToken",{personid})
    return needRenewToken
}